SIDE_ALL);
}
-/* Set the appropriate matrix for
- * patterns coming from the style context
- */
-static void
-style_pattern_set_matrix (cairo_pattern_t *pattern,
- gdouble width,
- gdouble height)
-{
- cairo_matrix_t matrix;
- gint w, h;
-
- if (cairo_pattern_get_type (pattern) == CAIRO_PATTERN_TYPE_SURFACE)
- {
- cairo_surface_t *surface;
-
- cairo_pattern_get_surface (pattern, &surface);
- w = cairo_image_surface_get_width (surface);
- h = cairo_image_surface_get_height (surface);
- }
- else
- w = h = 1;
-
- cairo_matrix_init_scale (&matrix, (gdouble) w / width, (gdouble) h / height);
- cairo_pattern_set_matrix (pattern, &matrix);
-}
-
static void
render_background_internal (GtkThemingEngine *engine,
cairo_t *cr,
gint border_width;
GtkBorderStyle border_style;
gdouble mat_w, mat_h;
- cairo_matrix_t identity;
/* Use unmodified size for pattern scaling */
mat_w = width;
flags = gtk_theming_engine_get_state (engine);
- cairo_matrix_init_identity (&identity);
-
gtk_theming_engine_get_background_color (engine, flags, &bg_color);
gtk_theming_engine_get_border (engine, flags, &border);
0, 0, width, height,
SIDE_ALL);
- style_pattern_set_matrix (other_pattern, mat_w, mat_h);
+ cairo_scale (cr, mat_w, mat_h);
cairo_set_source (cr, other_pattern);
+ cairo_scale (cr, 1.0 / mat_w, 1.0 / mat_h);
cairo_fill_preserve (cr);
- cairo_pattern_set_matrix (other_pattern, &identity);
-
/* Set alpha for posterior drawing
* of the target pattern
*/
SIDE_ALL);
if (pattern)
{
- style_pattern_set_matrix (pattern, mat_w, mat_h);
+ cairo_scale (cr, mat_w, mat_h);
cairo_set_source (cr, pattern);
+ cairo_scale (cr, 1.0 / mat_w, 1.0 / mat_h);
}
else
gdk_cairo_set_source_rgba (cr, &bg_color);
}
if (pattern)
- {
- cairo_pattern_set_matrix (pattern, &identity);
- cairo_pattern_destroy (pattern);
- }
+ cairo_pattern_destroy (pattern);
cairo_restore (cr);
}